import 'package:ati_package/core/extension/ati_widgets_extension.dart';
import 'package:ati_package/core/utils/ati_color.dart';
import 'package:ati_package/core/utils/ati_font.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get_navigation/get_navigation.dart';
import 'package:get/utils.dart';

class AtiDialog {
  //底部按键列表
  static bottomListBottomSheet({
    String? titleStr = '选择天数',
    List? dataList,
    VoidCallback? tapBack,
  }) {
    SmartDialog.show(
      alignment: Alignment.bottomCenter,
      builder: (_) => Container(
        // height: 180,
        width: double.infinity,
        decoration: const BoxDecoration(
          color: Colors.white,
          // borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
        ),
        child: SafeArea(
          top: false,
          child: Padding(
            padding: EdgeInsets.all(15.r),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text(
                  titleStr!,
                  style: TextStyle(
                    fontSize: AtiFont.font18,
                    color: Color(0xFF666666),
                  ),
                ),
                Container(
                  height: 1.r,
                  width: Get.width - 36.r,
                  margin: EdgeInsets.only(top: 10.r),
                  decoration: BoxDecoration(color: AtiColor.pageColor),
                  child: SizedBox(),
                ),
                ...dataList!.map((title) {
                  return Container(
                    height: 45.r,
                    padding: EdgeInsets.symmetric(vertical: 10.r),
                    child: Column(
                      children: [
                        Text(title),
                        SizedBox(height: 5.r),
                        Container(
                          height: 0.75.r,
                          width: Get.width - 36.r,

                          decoration: BoxDecoration(color: AtiColor.pageColor),
                          child: SizedBox(),
                        ),
                      ],
                    ),
                  ).addTapGesture(onTap: tapBack ?? () {});
                }),
                Container(
                  alignment: Alignment.center,
                  width: Get.width - 36.r,
                  margin: EdgeInsets.only(top: 10.r),
                  padding: EdgeInsets.symmetric(vertical: 7.5.r),
                  decoration: BoxDecoration(
                    color: AtiColor.pageColor,
                    borderRadius: BorderRadius.circular(5.r),
                  ),
                  child: Text('取消', style: TextStyle(fontSize: AtiFont.font16)),
                ).addTapGesture(onTap: SmartDialog.dismiss),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
